package com.sj.purchase.modules.cost.domain;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author: songkaizong
 * 18-1-9 下午5:05
 */
@Embeddable
public class ProfitId implements Serializable {
    @Temporal(TemporalType.DATE)
    private Date createDate;
    private String shopName;

    public ProfitId(Date createDate, String shopName) {
        this.createDate = createDate;
        this.shopName = shopName;
    }

    public ProfitId() {
    }

    public Date getCreateDate() {
        return createDate;
    }

    public String getShopName() {
        return shopName;
    }

    @Override
    public String toString() {
        return "ProfitId{" +
                "createDate=" + createDate +
                ", shopName='" + shopName + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProfitId profitId = (ProfitId) o;

        if (createDate != null ? !createDate.equals(profitId.createDate) : profitId.createDate != null) return false;
        return shopName != null ? shopName.equals(profitId.shopName) : profitId.shopName == null;
    }

    @Override
    public int hashCode() {
        int result = createDate != null ? createDate.hashCode() : 0;
        result = 31 * result + (shopName != null ? shopName.hashCode() : 0);
        return result;
    }
}
